<template>
  <div id="app">
    <el-drawer :visible.sync="drawer" :show-close="false" size="50%">
      <el-row>
        <el-col :span="6">名称</el-col>
        <el-col :span="16">{{ skuInfo.skuName }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="6">描述</el-col>
        <el-col :span="16">{{ skuInfo.skuDesc }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="6">价格</el-col>
        <el-col :span="16">{{ skuInfo.price }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="6">平台属性</el-col>
        <el-col :span="16">
          <el-tag
            type="success"
            v-for="item in skuInfo.skuAttrValueList"
            :key="item.id"
            style="margin-right: 10px"
          >
            {{ item.attrId }}--{{ item.valueId }}
          </el-tag>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">商品图片</el-col>
        <el-col :span="16">
          <el-carousel trigger="click" height="500px">
            <el-carousel-item
              v-for="item in skuInfo.skuImageList"
              :key="item.id"
            >
              <img :src="item.imgUrl" alt="" style="max-width: 100%" />
            </el-carousel-item>
          </el-carousel>
        </el-col>
      </el-row>
    </el-drawer>
  </div>
</template>

<script>
import { getSkuInfo } from "@/api/product/sku";
export default {
  data() {
    return {
      drawer: false, //是否显示抽屉
      skuInfo: {}, //sku数据
    };
  },
  methods: {
    async getInfo(row) {
      this.drawer = true;
      let res = await getSkuInfo(row.id);
      if (res.code == 200) {
        console.log(res);
        this.skuInfo = res.data;
      }
    },
  },
};
</script>

<style scoped>
.el-col-6 {
  text-align: right;
  margin-right: 10px;
  font-size: 18px;
  font-weight: 600;
}
.el-row {
  margin: 10px 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
::v-deep .el-carousel__button {
  width: 20px;
  height: 20px;
  background: #ccc;
  margin-right: 5px;
  border-radius: 50%;
}
::v-deep .el-carousel__indicator.is-active button {
  background: red;
}
</style>
